package hot100.logos81To90;

/**
 * @author logos
 * date 2025/7/17 19:43
 * @version v1.0
 * @Package hot100.logos81Tologos90
 */
public class logos81 {

    /**
     * 81. 爬楼梯
     * https://leetcode.cn/problems/climbing-stairs/?envType=study-plan-v2&envId=top-100-liked
     */

    class Solution {
        public int climbStairs(int n) {
            if (n == 1) {
                return 1;
            }
            if (n == 2) {
                return 2;
            }
            int a = 1;
            int b = 2;
            for (int i = 3; i <= n; i++) {
                int c = a + b;
                a = b;
                b = c;
            }
            return b;
        }
    }
}
